Hacker rank python list comprehension solution